package com.thomsonreuter.search.compare.parser;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.util.Map;

public class Test {

    public void test(){
        String source = "{\"RCSPriceTypeGenealogy\":\"M:D1\\\\quoteType:1\",\"SynonymSearchAll\":\"vol volatility volatilities vols\"}";
        Gson gson = new GsonBuilder().disableHtmlEscaping().create();
        Map<String,Object> sourceMap = gson.fromJson(source,Map.class);
        sourceMap.entrySet().stream().forEach(s-> System.out.println("key:" +s.getKey() +" value:" + s.getValue()));
        System.out.println("=============================================");
        String target = "{\"RCSPriceTypeGenealogy\":\"M:D2\\\\quoteType:3\",\"SynonymSearchAll\":\"ls\"}";
        Map<String,Object> targetmap = gson.fromJson(target,Map.class);
        targetmap.entrySet().stream().forEach(t -> System.out.println("key:" + t.getKey() + " value:" + t.getValue()));
    }

    public static void main(String[] args){
        Test test = new Test();
        test.test();
    }
}
